<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>PiperChat</title>
		<link rel="stylesheet" href="css/amazeui.min.css" />
		<link rel="stylesheet" href="css/main.css" />
	</head>

	<body>
		<div id="login-box" class="am-u-sm-4 am-u-sm-centered">
			<form name="loginForm" class="am-form am-form-horizontal">
				<div class="am-form-group">
					<div class="am-u-sm-10">
						<input name="email" type="email" id="doc-ipt-3" placeholder="输入你的电子邮件">
					</div>
				</div>

				<div class="am-form-group">
					<div class="am-u-sm-7">
						<input name="pwd" type="password" id="doc-ipt-pwd-1" placeholder="输入密码">
					</div>
					<span class="am-u-sm-3" style="border: 1px solid #d9d9d9;">获取验证码</span>
				</div>

				<div class="am-form-group">
					<div class="am-u-sm-10">
						<button type="button" class="am-btn am-btn-primary am-btn-block">提交登入</button>
					</div>
				</div>
			</form>
		</div>


		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/han.avatar.js"></script>
		<script type="text/javascript" src="js/layer/layer.js"></script>
		<script type="text/javascript" src="js/mustache.js"></script>
		<script type="text/javascript" src="js/amazeui.min.js"></script>
		<script type="text/javascript" src="js/zUI.js"></script>
		<script type="text/javascript" src="js/config.js"></script>
		<script type="text/javascript" src="js/user.js"></script>
		<script type="text/javascript" src="js/request.js"></script>

		<script>
			window.onload = function() {
				$("button:button").click(function() {
					let msg = {
						email: loginForm.email.value,
						pwd: loginForm.pwd.value
					}
					ajax.post('login', msg, function(data) {
						setToken(data.data.token)
						setUserInfo(data.data.user)
						location.href = "index.html"
					})
				})
			}
		</script>
	</body>

</html>
